var windowwidth = document.documentElement.clientWidth;

var windowHeight = document.documentElement.clientHeight;
// 浏览器中心点的横坐标
var centerX = windowwidth/2;
// 浏览器中心点的纵坐标
var centerY = windowHeight/2;

$("#xc div").each(function(){
    // 随机生成横坐标
    var x = Math.random()*600-300;
    x = Math.floor(x);
    x = centerX + x-50 ;
    // 随机生成纵坐标
    var y = Math.random()*500-200;
    y = Math.floor(y);
    y = centerY + y-50 ;


    $(this).css("left",x+"px");
    $(this).css("top",y+"px");

    // 随机生成一个角度
    var angle = Math.random()*40;
    angle = angle>20?angle+20:angle;
    angle-=30;
    angle = Math.floor(angle);




    // 设置旋转
    $(this).css("transform","rotate("+angle+"deg)");
})




$("#xc div a").fancybox();

